package com.demo.extfunction;

import com.demo.annotation.Aspectj;
import com.demo.annotation.Around;
import com.demo.annotation.Component;
import com.demo.annotation.PointCut;
import com.demo.enhance.JoinPoint;

import java.time.LocalDateTime;
@Aspectj
@Component
public class TimeRocord {
    @PointCut("com.demo.entity.EchoImpl.echo")//方法切入
    public void pointCut(){};
    @Around
    public Object around(JoinPoint joinPoint){
        Object ret=null;
        try {
            System.out.println("begin time "+LocalDateTime.now());
             ret = joinPoint.proceed();
            System.out.println("end time "+LocalDateTime.now());
        } catch (Throwable e) {
            e.printStackTrace();
        }
        return ret;
    }
}
